home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / sup / PORT / step07 / supfilesrv.c.diff < prev    next >
Encoding:
Text File  |  1994-08-02  |  2.0 KB  |  99 lines

  1. *** ../step06/supfilesrv.c    Fri Dec 17 12:49:41 1993
  2. --- supfilesrv.c    Fri Dec 17 16:41:08 1993
  3. ***************
  4. *** 233,238 ****
  5. --- 233,241 ----
  6.   #include <sys/stat.h>
  7.   #include <sys/file.h>
  8.   #include <sys/dir.h>
  9. + #ifdef _ABI_SOURCE
  10. + #include <sys/sysmacros.h>
  11. + #endif
  12.   #if    MACH
  13.   #include <sys/ioctl.h>
  14.   #endif
  15. ***************
  16. *** 441,452 ****
  17.   
  18.   chldsig()
  19.   {
  20.       union wait w;
  21.   
  22. !     /* XXX all the signal stuff needs attention */
  23.       while (wait3(&w, WNOHANG, (struct rusage *)0) > 0) {
  24.           if (nchildren) nchildren--;
  25.       }
  26.   }
  27.   
  28.   /*****************************************
  29. --- 444,464 ----
  30.   
  31.   chldsig()
  32.   {
  33. + #ifdef _ABI_SOURCE
  34. +     int w;
  35. + #else
  36.       union wait w;
  37. + #endif
  38.   
  39. ! #ifdef _ABI_SOURCE
  40. !     while (waitpid((pid_t)-1, &w, WNOHANG) > 0) {
  41. !         if (nchildren) nchildren--;
  42. !     }
  43. ! #else
  44.       while (wait3(&w, WNOHANG, (struct rusage *)0) > 0) {
  45.           if (nchildren) nchildren--;
  46.       }
  47. + #endif
  48.   }
  49.   
  50.   /*****************************************
  51. ***************
  52. *** 722,727 ****
  53. --- 734,742 ----
  54.       register FILE *f;
  55.       struct stat sbuf;
  56.       register TREELIST *tl;
  57. + #ifdef _ABI_SOURCE
  58. +     struct flock lock;
  59. + #endif
  60.   
  61.       if (protver > 7) {
  62.           cancompress = TRUE;
  63. ***************
  64. *** 911,916 ****
  65. --- 926,948 ----
  66.       (void) sprintf (buf,FILELOCK,collname);
  67.       x = open (buf,O_RDONLY,0);
  68.       if (x >= 0) {
  69. + #ifdef _ABI_SOURCE
  70. +         /* lock setup: read lock for whole file */
  71. +         lock.l_type = F_RDLCK;
  72. +         lock.l_start = 0;
  73. +         lock.l_whence = 0;
  74. +         lock.l_len = 0;
  75. +         if (fcntl (x, F_SETLK, &lock) < 0) {
  76. +             (void) close (x);
  77. +             if (errno != EACCES)
  78. +                 goaway ("Can't lock collection %s",collname);
  79. +             setupack = FSETUPBUSY;
  80. +             (void) msgsetupack ();
  81. +             if (protver >= 6)  longjmp (sjbuf,TRUE);
  82. +             goaway ("Sup client told to wait for lock");
  83. +         }
  84. +         lockfd = x;
  85. + #else
  86.           if (flock (x,(LOCK_SH|LOCK_NB)) < 0) {
  87.               (void) close (x);
  88.               if (errno != EWOULDBLOCK)
  89. ***************
  90. *** 921,926 ****
  91. --- 953,959 ----
  92.               goaway ("Sup client told to wait for lock");
  93.           }
  94.           lockfd = x;
  95. + #endif
  96.       }
  97.       setupack = FSETUPOK;
  98.       x = msgsetupack ();
  99.